#ifndef FASYS_LIBS_API_MESSAGE_JSON_HPP
#define FASYS_LIBS_API_MESSAGE_JSON_HPP

#include "message.hpp"
#include "names.hpp"
#include "types.hpp"
#include <fas/misc/json.hpp>

namespace fasys{ namespace api{

namespace aj = ::fas::json;
namespace ap = ::fas::pattern;

typedef
  aj::object<
    message_base,
    ap::type_list_n<
      aj::member<n_order, message_base, order_t, &message_base::order>,
      aj::member<n_create_time, message_base, time_t, &message_base::create_time>,
      aj::member<n_lifetime, message_base, time_t, &message_base::lifetime>,
      aj::member<n_limit, message_base, size_t, &message_base::limit>
    >::type
  > message_base_json;

typedef
  aj::object<
    message_publish,
    ap::type_list_n<
      message_base_json::member_list,
      aj::member<n_channel, message_publish, std::string, &message_publish::channel>,
      aj::member<n_content, message_publish, data_t, &message_publish::content,  aj::raw_value<data_t> >
    >::type
  > message_publish_json;

typedef
  aj::object<
    message_notify,
    ap::type_list_n<
      message_publish_json::member_list,
      aj::member<n_message_id, message_notify, message_id_t, &message_notify::message_id>,
      aj::member<n_channel_id, message_notify, channel_id_t, &message_notify::channel_id>,
      aj::member<n_count, message_notify, size_t, &message_notify::count>,
      aj::member<n_death_time, message_notify, time_t, &message_notify::death_time>,
      aj::member<n_death_timespan, message_notify, time_t, &message_notify::death_timespan>
    >::type
  > message_notify_json;

}}

#endif
